package zy1219.zy2;

import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;

public class MainApp {
    public static void main(String[] args) throws InvocationTargetException, IllegalAccessException, NoSuchMethodException {
        Phone phone = new Phone();
        BeanUtils.setProperty(phone,"brand","华为");
        BeanUtils.setProperty(phone,"color","黑色");
        BeanUtils.setProperty(phone,"price",3999.0);
        BeanUtils.setProperty(phone,"size",6.4);

        String brand = BeanUtils.getProperty(phone, "brand");
        String color = BeanUtils.getProperty(phone, "color");
        double price = Double.parseDouble(BeanUtils.getProperty(phone, "price"));
        double size = Double.parseDouble(BeanUtils.getProperty(phone, "size"));
        System.out.println(brand);
        System.out.println(color);
        System.out.println(price);
        System.out.println(size);



    }
}
